[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
A_SIZE()
Dynamically change the size or dimensions of an array
-------------------------------------------------------------------------------
Syntax
A_SIZE( @<aTarget>,
<nElements>,
[, <nElements>...] ) -> lSuccess
Arguments
<aTarget> is the array to re-size. It must be passed-by-
reference. A_SIZE() cannot resize binary type arrays.
<nElements> are the new dimensions of the array.
Returns
A_SIZE() returns (.T.) if the function was successful, otherwise,
it returns (.F.). In addition, the aTarget array is modified.
Description
A_SIZE() modifies the dimensions of the @<aTarget>. If the
array is increased in size, the new elements will be added to the
end of the array and assigned to null. If the array is decreased
in size, the data at the end of the array will be lost.
You cannot change the number of dimensions with A_SIZE(), rather,
you can change only their magnitude.
Examples
// Declare a two dimensional (L)ong integer array
LOCAL rows, cols, x, y, z := 0
rows = 10
cols = 20
aLong = A_DECLARE( "L", rows, cols )
// Fill the array with increasing values.
FOR x = 1 to rows
FOR y = 1 to cols
A_STORE( aLong, z++, A_( x, y ) )
NEXT
NEXT
// Increase the size of the array by 10 rows
A_SIZE( @aLong, rows + 10, cols )
// Show some results.
? A_RETRIEVE( aLong, 10, 20 ) // Result: 200
? A_RETRIEVE( aLong, 11, 1 ) // Result: 0
See Also:
A_ADD()
A_DEL()
A_INS()
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson